<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

<!--    <link rel="stylesheet" href="/static/xadmin/lib/layui/css/layui.css" media="all">-->
    <title>商品表格</title>
</head>
<body>
<div class="layui-container">
    <form>
        <table class="layui-hide" id="goodstable" lay-data="{id: 'goodstable'}"></table>
        <script type="text/html" id="goodsId">
            <input type="radio" id="goods_id" name="goods_id" value="{{d.id}}">
        </script>
        <script type="text/html" id="goodsImg">
            <img width="50px" src="{{d.image}}" alt="">
        </script>

        <button id="button" data-refresh="true" class="layui-btn" lay-filter="add" lay-submit="">增加</button >
    </form>
</div>
</body>
</html>
<script src="/static/layui.js" charset="utf-8"></script>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
</script>
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script>
    layui.use(['table', 'form', 'layer', 'jquery'], function () {
        var table = layui.table,
            jquery = layui.jquery,
            form = layui.form,
            layer = layui.layer;
        table.render({
            elem: '#goodstable'
            , id: 'goodstable'
            , url: '/admin/goods.BargainController/goodsList'
            , width: 1000
            , page: true
            , cols: [[
                {field: 'id', width: 100, title: '选择', templet: "#goodsId"}
                , {field: 'id', width: 100, title: 'ID',}
                , {field: 'logo', width: 100, title: '商品图', templet: '#goodsImg'}
                , {field: 'title', width: 200, title: '商品名称', templet: "#商品名称"}
                , {field: 'market_price', width: 150, title: '商品价格'}
            ]]
        });

        // var loding = layer.load(0,{
        //     icon:2,
        //     shade:false,
        //     time:2*1000
        // })
            ea.listen();
    }

    );
</script>
<script>

    $('#button').click(function () {
        // var index = parent.layer.getFrameIndex(window.name)
        // var goods = $('#goods_id').val();
        var tr = $('input[name="goods_id"]:checked').val()
        console.log(tr)
        parent.getMasterIds(tr)


        // window.parent.location.reload();

    })
</script>